package com.pactera.madp.cp.controller.sidebar.employee;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pactera.madp.common.core.util.R;
import com.pactera.madp.cp.api.dto.emp.EmpIndexDTO;
import com.pactera.madp.cp.api.em.permission.ReqPerEnum;
import com.pactera.madp.cp.service.IWorkEmployeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: yangpengwei
 * @time: 2020/12/4 2:39 下午
 * @description 企业成员
 */
@RestController
@AllArgsConstructor
@RequestMapping("/workemployeewechat")
@Api(value = "workemployee", tags = "企业成员-侧边栏")
public class EmployeeSidebarController {

    private IWorkEmployeeService employeeService;

    /**
     * 成员 - 成员列表
     */
    @GetMapping("/page")
    @ApiOperation(value = "查询成员列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name="permission",value="权限:ALL-全部,DEPARTMENT-部门,EMPLOYEE-员工")
    })
    public R index(EmpIndexDTO req, ReqPerEnum permission, Page page) {
        return employeeService.indexWechat(req, permission,page);
    }

    /**
     * 成员 - 成员列表搜索条件数据
     */
    @GetMapping("/searchcondition")
    @ApiOperation(value = "成员列表搜索条件数据")
    public R searchCondition() {
        return R.ok(employeeService.searchConditionWechat());
    }

    @GetMapping("/change/{wxUserId}/{wxExternalUserid}/{id}")
    @ApiOperation(value = "转接客户确认")
    @ApiImplicitParams({
            @ApiImplicitParam(name="wxUserId",value="转接用户微信id",dataType="String"),
            @ApiImplicitParam(name="wxExternalUserid",value="客户id",dataType="String"),
            @ApiImplicitParam(name="id",value="当前用户微信id",dataType="String")
    })
    public R changeByUser(@PathVariable String wxUserId,@PathVariable String wxExternalUserid,@PathVariable String id){
        return employeeService.changeUser(wxUserId, wxExternalUserid,id);
    }

}
